<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>第三次作业一</title>
    <script src="https://unpkg.com/vue@3"></script>
</head>
<body>


<div id="app">
    <button :class="'but' + index"
            v-for="(i,index) in movie_name"
            @click="is_red = index"
            :style="index === is_red? button_style : null"
    >
        {{i}}
    </button>
</div>

<script>
    const {createApp} = Vue

    createApp({
        data() {
            return {
                movie_name: ["教父", "阿甘正传", "楚门的世界", "盗梦空间"],
                is_red: 0,
                button_style: {
                    backgroundColor: "red",
                },
            }

        },
        methods: {
            clickBut(index) {

            },

        }
    }).mount('#app')
</script>
</body>
</html>